package com.zhou.core.jdbc;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhouyongjun on 2020/7/14
 */
public class SqlQueryRowResult {
    Map<String,Object> map;

    public SqlQueryRowResult()
    {
        map = new HashMap<>();
    }
    public SqlQueryRowResult(Map<String,Object> map)
    {
        this.map = map;
    }

    public <T> T getT(String key,Class<T> clazz)
    {
        return (T) map.get(key);
    }
    public Object get(String key)
    {
        return map.get(key);
    }
    public Object get(String key,Object defaultV)
    {
        Object value = get(key);

        return value == null ? defaultV : value;
    }
    public <T> T getT(String key,T defaultT,Class<T> clazz)
    {
        T value = getT(key,clazz);
        return value == null ? defaultT : value;
    }

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }
}
